package com.ftg.learn.springboot.demo.service;

import com.ftg.learn.springboot.demo.mapper.StudentMapper;
import com.ftg.learn.springboot.demo.pojo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentService {

	@Autowired
	StudentMapper studentMapper;
	public List<Student>  list(){
		return studentMapper.list();
	}

	public List<Student> showAll(int page, int limit,String deptno) {

		deptno = ("".equals(deptno) ? null : deptno);
		int begin = (page-1) * limit;
		return studentMapper.showAll(begin,limit,deptno);
	}

	public int getcount(String deptno) {

		deptno = ("".equals(deptno) ? null : deptno);
		return studentMapper.getCount(deptno);
	}

	public int del(int id) {

		return studentMapper.del(id);
	}

	public int update(Student student) {

		return studentMapper.update(student);
	}

	public int add(Student student) {

		return studentMapper.add(student);
	}

}
